473,424 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,424 software developers and data experts.

CSS floating element doesn't wrap

JHR
Hey all,

I'm trying to make a sidebar box float to the right of various items,
and for those items to wrap if a user shrinks his browser window.
Instead, in every browser I've tried except for Internet Explorer (in
Safari, Firefox, and other Mozilla-types), the box ends up overlapping
with the second and third rows of the text (which are in an ordered list
with some 'display: table-cell' formats defined in order to allow
specific alignment).

The first row raps correctly, but the subsequent ones overlap with the
text going physically behind the box; in Internet Explorer, all
left-aligned lines wrap in order to make room for the floating sidebar,
which is what I want. The only thing I've been able to do is set a
background color for the sidebar, which prevents the dotted line from
going through it but not the text. I've tried adding a 'clear: left' tag
to no avail.

I'll paste the code below, or you can look at the misbehavior in action at:

http://www.sigga.org/bad-css/index.html

Shrink the window to the left, and you'll see what happens. The top word
doesn't overlap and instead wraps, but the indented line overlaps with
the sidebox, which I really don't want (it should wrap instead).

[yes, I know it's missing the doctype, overall structure, etc., and
doesn't look like much of anything design-wise, this is just an example
pared down from my actual code to show the bad css.]

Any ideas what might be wrong? Incredibly grateful in advance,
JHR

==========
The barebones HTML code, with innards removed, looks like this (same as
at weblink above):

<div class="floating-sidebar">
<ul><li>random items, various formatting</li></ul>
</div>

<p>

<div class="first-line">text</div>
<ul>
<li class="subsequent-lines">
<span class="subsequent-line-part-1">text</span>
<span class="subsequent-line-part-2">text
<span class="subsequent-line-part-3">text
</span></span>
</li></ul>

The relevant (I think) CSS definitions (ie., I'm omitting things that
only relate to fonts, etc. as opposed to placement) are:

.floating-sidebar {
float: right;
padding: 7px;
border: 3px outset lightgray;
margin-right: 20px;
}

/* this next one wraps correctly */

.first-line {
margin-bottom: -10px;
margin-top: 25px;
border-top: 1px dashed #666633;
}

/* these next four, all on the same line but often repeated on several
lines, all fail to wrap around the sidebar */

.subsequent-lines {
display: table;
border-bottom: 1px dotted #666633;
padding: 2px;
padding-top: 4px;
width: 100%;
}

.subsequent-line-part-1 {
display: table-cell;
width: 65px;
}

.subsequent-line-part-2 {
display: table-cell;
}

.subsequent-line-part-3 {
}
Jul 20 '05 #1
3 10743
JHR <ne********@sigga.org> wrote:
I'm trying to make a sidebar box float to the right of various items,
and for those items to wrap if a user shrinks his browser window.
Instead, in every browser I've tried except for Internet Explorer (in
Safari, Firefox, and other Mozilla-types), the box ends up overlapping
with the second and third rows of the text (which are in an ordered list
with some 'display: table-cell' formats defined in order to allow
specific alignment).
IE doesn't support CSS tables.
http://www.sigga.org/bad-css/index.html

Shrink the window to the left, and you'll see what happens. The top word
doesn't overlap and instead wraps, but the indented line overlaps with
the sidebox, which I really don't want (it should wrap instead).


Your example makes no sense, your description of what you want to happen
doesn't clarify things, if anything it throws up more questions.

Don't post code to the group, validate your HTML and CSS first,
expecting us to correct your errors before we can get to the question
isn't likely to yield a good response.

--
Spartanicus
Jul 20 '05 #2
Spartanicus <me@privacy.net> wrote:
http://www.sigga.org/bad-css/index.html


Your example makes no sense, your description of what you want to happen
doesn't clarify things, if anything it throws up more questions.


Upon loading the example in Mozilla it makes some sense, set display to
inline if you want to format the list that way. Google for "ALA Taming
Lists" for a tutorial on how to format lists.

--
Spartanicus
Jul 20 '05 #3
JHR
> Don't post code to the group, validate your HTML and CSS first,
expecting us to correct your errors before we can get to the question
Well, that was the problem - the HTML and CSS does validate just fine,
it just produces unexpected behavior in browsers other than Internet
Explorer (which seems the reverse of what should happen, given that IE
doesn't support CSS tables, as you say).

However, changing the code as you suggest in your second message, to
make the display inline instead of table, causes the wrap to work
correctly. Thanks - precisely what I needed!

Spartanicus wrote:
JHR <ne********@sigga.org> wrote:

I'm trying to make a sidebar box float to the right of various items,
and for those items to wrap if a user shrinks his browser window.
Instead, in every browser I've tried except for Internet Explorer (in
Safari, Firefox, and other Mozilla-types), the box ends up overlapping
with the second and third rows of the text (which are in an ordered list
with some 'display: table-cell' formats defined in order to allow
specific alignment).

IE doesn't support CSS tables.

http://www.sigga.org/bad-css/index.html

Shrink the window to the left, and you'll see what happens. The top word
doesn't overlap and instead wraps, but the indented line overlaps with
the sidebox, which I really don't want (it should wrap instead).

Your example makes no sense, your description of what you want to happen
doesn't clarify things, if anything it throws up more questions.

Don't post code to the group, validate your HTML and CSS first,
expecting us to correct your errors before we can get to the question
isn't likely to yield a good response.

Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Andrew Straw | last post by:
I'm running into trouble when calling a 3rd party library (the Intel IPP library to do some fast math on a P4 processor). This is on debian linux 2.6.7 using python 2.3.4. I've been using Pyrex...
3
by: Andrew | last post by:
Hi I've tried a number of techniques but this one is causing me to wonder whether I'm going to have to go back to using tables to solve this: I want to have some text aligned to the left and...
16
by: Michael Bernstein | last post by:
Hello, I've tried to solve this problem six ways from sunday, but I'm conceding defeat and asking for help at this point. The following site is rendering *very* oddly in Mozilla only. IE seems...
3
by: Mark Tranchant | last post by:
On my site, I use a background image of a small arrow to denote links that lead away from my site. This page has four such links in the first section: http://tranchant.plus.com/notes/cable-wrap...
2
by: Lee K. Seitz | last post by:
I stayed up late working on a CGI script and spent some time formatting my page with CSS. It looked fine in IE, which will be 95% of my audience, so I went to bed. Got up and looked at it in...
11
by: Stephen Poley | last post by:
I'd like to float an image to the bottom of a DIV containing several paragraphs, so that it is positioned to the right of the closing paragraphs (and preferably below the closing paragraphs if the...
1
by: bryanrite | last post by:
I have two floating divs within a 100% width container div. In IE when you resize the window to the point where the text should wrap, it wraps and extends the height of the container div. In...
9
by: ssubbarayan | last post by:
Hi all, I am trying a program to convert floating point values to a byte array and printing the same to the screen.The idea behind this is we already have an existing function which can do byte...
4
dlite922
by: dlite922 | last post by:
This is just barely above my head when it comes to css. I have a div that needs to contain rows of floating divs, but I need each row not to wrap on to the next one and continue to go right. The...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.